package com.lifeonwalden.ms.web.controller;

import com.lifeonwalden.ms.web.bean.Response;
import com.lifeonwalden.ms.web.service.PersonService;
import com.lifeonwalden.ms.web.util.ResponseUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/person")
public class PersonController {
    @Autowired
    private PersonService personService;

    @GetMapping("get")
    Response get(@RequestParam String name) {
        return ResponseUtil.success(personService.fetch(name));
    }

    @GetMapping("get15s")
    Response get15s(@RequestParam String name) {
        return ResponseUtil.success(personService.fetch15s(name));
    }

    @GetMapping("get15sOther")
    Response get15sOther(@RequestParam String name) {
        return ResponseUtil.success(personService.fetch15s_other(name));
    }

    @GetMapping("get60s")
    Response get60s(@RequestParam String name) {
        return ResponseUtil.success(personService.fetch60s(name));
    }
}
